package weixinkeji.dev.power.center.check;

import java.lang.reflect.Field;
import java.util.HashSet;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import weixinkeji.dev.power.SysPower;

/**
 *
 * @author IMY
 */
public class CheckSysPower {

    private final Set<String> powerID = new HashSet();

    public CheckSysPower() {
        for (Field f : SysPower.class.getDeclaredFields()) {
            try {
//                System.out.println(f.get(f.getName()));
                powerID.add(f.get(f.getName()).toString());
            } catch (IllegalArgumentException | IllegalAccessException ex) {
                Logger.getLogger(CheckSysPower.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }

    public boolean isSysPower(String id) {
        return powerID.contains(id);
    }

}
